package com.shelpe.services.tenant.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class DicWord {
	
	private static final Logger logger = LoggerFactory.getLogger(DicWord.class);
	
	private String word;//词
	
	private String pos;//词性
	
	private Integer freq;//词频
	
	public DicWord(){
		
	}
	

	public DicWord(String line){
		
		String[] value = line.split("\t");
		//for(int i = 0; i < value.length; i++){
		//	logger.info("DicWord line : {}", value[i]);
		//}
	
		if(value.length == 3){
			word = value[0];
			pos = value[1];
			freq = Integer.valueOf(value[2]);
		}
	}

	public String getWord() {
		return word;
	}

	public void setWord(String word) {
		this.word = word;
	}

	public String getPos() {
		return pos;
	}

	public void setPos(String pos) {
		this.pos = pos;
	}

	public Integer getFreq() {
		return freq;
	}

	public void setFreq(Integer freq) {
		this.freq = freq;
	} 
	
	
	public String transToString(){
		
		StringBuilder sb = new StringBuilder();
		sb.append(word);
		sb.append("\t");
		sb.append(pos);
		sb.append("\t");
		sb.append(freq);
		sb.append("\n");
		
		return sb.toString();
	}

}
